Skip to content

chore: migrate from archived golang/mock to go.uber.org/mock#130

Merged
AdriaCarrera merged 2 commits into
mainfrom
chore/migrate-golang-mock-uber-mock
May 13, 2026
Merged

chore: migrate from archived golang/mock to go.uber.org/mock#130
AdriaCarrera merged 2 commits into
mainfrom
chore/migrate-golang-mock-uber-mock

Conversation

@kpitapeersyst
Copy link
Copy Markdown
Contributor

@kpitapeersyst kpitapeersyst commented Apr 28, 2026

chore: migrate from archived golang/mock to go.uber.org/mock

Motivation 💡

github.com/golang/mock was archived by Google in June 2023 and is no longer maintained. The community-supported fork go.uber.org/mock is now the recommended replacement, receiving Go version compatibility updates and bug fixes.

Changes 🛠

  • Replaced github.com/golang/mock with go.uber.org/mock in go.mod
  • Updated mockgen install target in the Makefile to go.uber.org/mock/mockgen@v0.6.0
  • Switched the gomock import from github.com/golang/mock/gomock to go.uber.org/mock/gomock in all x/poa test files
  • Regenerated the x/poa/testutil mocks with the new mockgen to match the updated package layout

Summary by CodeRabbit

  • Chores

    • Updated mock testing tooling to a newer provider for improved test tooling compatibility.
  • Tests

    • Regenerated and updated mock artifacts to align with the new tooling and modernized mock APIs, improving test consistency and maintainability.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 28, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c1cdda2d-2e9f-452f-a9cf-edcc3f85f77d

📥 Commits

Reviewing files that changed from the base of the PR and between caf9fe9 and b0ba2c9.

📒 Files selected for processing (4)
  • x/poa/ante/poa_test.go
  • x/poa/keeper/common_test.go
  • x/poa/keeper/keeper_test.go
  • x/poa/keeper/msg_server_add_validator_test.go
✅ Files skipped from review due to trivial changes (4)
  • x/poa/keeper/msg_server_add_validator_test.go
  • x/poa/keeper/keeper_test.go
  • x/poa/keeper/common_test.go
  • x/poa/ante/poa_test.go

📝 Walkthrough

Walkthrough

This PR migrates the mocking toolkit from golang/mock to go.uber.org/mock by updating the Makefile and go.mod to install/use mockgen v0.6.0 and regenerating mock artifacts and test imports; mock recorder parameter types were modernized from interface{} to any, and mock structs gained isgomock marker fields.

Changes

Cohort / File(s) Summary
Build Configuration
Makefile, go.mod
Switch mockgen install target to go.uber.org/mock/mockgen v0.6.0 and replace github.com/golang/mock requirement with go.uber.org/mock.
Test File Imports
x/poa/ante/poa_test.go, x/poa/keeper/common_test.go, x/poa/keeper/keeper_test.go, x/poa/keeper/msg_server_add_validator_test.go
Import paths updated from github.com/golang/mock/gomockgo.uber.org/mock/gomock; test logic unchanged.
Generated Mocks
x/poa/testutil/expected_keepers_mock.go, x/poa/testutil/expected_msg_server_mock.go, x/poa/testutil/keys_mock.go, x/poa/testutil/staking_hooks_mock.go, x/poa/testutil/tx_mock.go
Mocks regenerated: gomock import switched to go.uber.org/mock/gomock, added isgomock struct{} marker fields on mock types, recorder method parameter types changed from interface{}any, and file headers now include the exact mockgen command used.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐇 I hopped from golang mock to Uber's glint,
Swapped interface{} for any in a sprint.
Marker fields tucked in, mocks reborn,
I wiggle my nose at the CI at dawn. 🥕

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: migrating from archived golang/mock to go.uber.org/mock, which matches the core focus of the entire changeset.
Description check ✅ Passed The description follows the template structure with all key sections (Motivation, Changes) properly filled out; Considerations and Dependencies sections are appropriately omitted as non-critical.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/migrate-golang-mock-uber-mock

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.11.4)

Error: can't load config: unsupported version of the configuration: "" See https://golangci-lint.run/docs/product/migration-guide for migration instructions
The command is terminated due to an error: can't load config: unsupported version of the configuration: "" See https://golangci-lint.run/docs/product/migration-guide for migration instructions


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.

Comment @coderabbitai help to get the list of available commands and usage tips.

@AdriaCarrera AdriaCarrera merged commit 0ca6124 into main May 13, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants